#include "SNFeatureEvaluator.h"
#include "SNLBPEvaluator.h"


SNFeatureEvaluator::SNFeatureEvaluator()
{
}


SNFeatureEvaluator::~SNFeatureEvaluator()
{
}

void SNFeatureEvaluator::Init(const SNFeatureParams* feature_params, int max_sample_count, cv::Size win_size)
{
	FeatureParams = (SNFeatureParams*)feature_params;
	WinSize = win_size;

	NumFeatures = 0;
	
	cls.create((int)max_sample_count, 1, CV_32FC1);
	GenerateFeatures();
}

void SNFeatureEvaluator::SetImage(const cv::Mat& img, uchar cls_label, int idx)
{
	//CV_Assert(img.cols == winSize.width);
	//CV_Assert(img.rows == winSize.height);
	//CV_Assert(idx < cls.rows);
	cls.ptr<float>(idx)[0] = cls_label;
}

cv::Ptr<SNFeatureEvaluator> SNFeatureEvaluator::Create(int type)
{
	return
		type == SNFeatureParams::LBP ? cv::Ptr<SNFeatureEvaluator>(new SNLBPEvaluator()) :
		cv::Ptr<SNFeatureEvaluator>();
}
